﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.Migrations
{
    public partial class log2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DeepProcessingEnterprises");

            migrationBuilder.DropTable(
                name: "SlaughterEnterprises");

            migrationBuilder.RenameColumn(
                name: "FarmName",
                table: "EnterpriseInfos",
                newName: "ProductionLicense");

            migrationBuilder.AlterColumn<string>(
                name: "ProductionBatch",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn<string>(
                name: "PersonInCharge",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn<string>(
                name: "LivestockInventory",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "EnterpriseInfos",
                type: "bit",
                nullable: true,
                oldClrType: typeof(bool),
                oldType: "bit");

            migrationBuilder.AddColumn<string>(
                name: "Address",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "City",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CompanyName",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "County",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Description",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "EstablishmentDate",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Province",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Address",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "City",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "CompanyName",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "County",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "Description",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "EstablishmentDate",
                table: "EnterpriseInfos");

            migrationBuilder.DropColumn(
                name: "Province",
                table: "EnterpriseInfos");

            migrationBuilder.RenameColumn(
                name: "ProductionLicense",
                table: "EnterpriseInfos",
                newName: "FarmName");

            migrationBuilder.AlterColumn<string>(
                name: "ProductionBatch",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "PersonInCharge",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "LivestockInventory",
                table: "EnterpriseInfos",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "EnterpriseInfos",
                type: "bit",
                nullable: false,
                defaultValue: false,
                oldClrType: typeof(bool),
                oldType: "bit",
                oldNullable: true);

            migrationBuilder.CreateTable(
                name: "DeepProcessingEnterprises",
                columns: table => new
                {
                    EnterpriseId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    CompanyName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    ProductionBatch = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductionLicense = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeepProcessingEnterprises", x => x.EnterpriseId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterEnterprises",
                columns: table => new
                {
                    EnterpriseId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    City = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    County = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EstablishmentDate = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    ProductionBatch = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Province = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterEnterprises", x => x.EnterpriseId);
                });
        }
    }
}
